# Contributor: Michael Jeanson <mjeanson@efficios.com>
# Maintainer: Michael Jeanson <mjeanson@efficios.com>
pkgname=lttng-tools
pkgver=2.13.7
pkgrel=1
pkgdesc="LTTng 2.0 control and utility programs"
url="https://lttng.org"
arch="all"
license="GPL-2.0-only LGPL-2.1-only"
depends="babeltrace"
depends_dev="kmod-dev libxml2-dev lttng-ust-dev popt-dev userspace-rcu-dev
	util-linux-dev"
makedepends="$depends_dev autoconf automake bash coreutils grep libtool"
checkdepends="util-linux"
subpackages="$pkgname-static $pkgname-dev $pkgname-doc"
source="https://lttng.org/files/lttng-tools/lttng-tools-$pkgver.tar.bz2
	test.patch
	s390x-tests.patch.noauto
	"

prepare() {
	default_prepare
	# patch out failing test for s390x, upstream investigating
	case "$CARCH" in
		s390x) patch -p1 -i "$srcdir"/s390x-tests.patch.noauto
	esac
	# We patch Makefile.am
	autoreconf -fi
}
build() {
	unset LDFLAGS
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--localstatedir=/var
	make V=1
}

check() {
	# only run unit tests. all tests takes too much time
	make -j1 -C tests/unit check
}

package() {
	make DESTDIR="$pkgdir" install
	mkdir -p "$pkgdir"/usr/share/licenses/$pkgname
	mv "$pkgdir"/usr/share/doc/$pkgname/LICENSE \
		"$pkgdir"/usr/share/licenses/$pkgname/
}

sha512sums="
e5730cb600d39f4e5608fc14f5a211628c3eb1de043cf36fdd021c5d3d0e5e9f1d95bbde554c7ad33b5c1c817ae6a8a893f5cf52a678adf82a2f2c95565a127d  lttng-tools-2.13.7.tar.bz2
1f4d0591b55955a698fe9767c8ce2676a25abdd6e2fb2d7addea8e23cf332c32631ca3d86bb2d1b0239cad972eb649418284ff12f36993373a15a9578dc52401  test.patch
d1e8d1d6f9abfb165acb181772b3eaf3f6e3caed5a7088e24b40a17eac6109bc92e485f77a2fc65c15f16e482a7d650d5f25c04b58073df47feb84e1855d650a  s390x-tests.patch.noauto
"
